import 'package:flutter/material.dart';
import './widget/appbar-widget.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.dark(),
      home: MyHomePage()
    );
  }
}

class MyHomePage extends StatefulWidget {
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  int _currentIndex = 0;

  final List<Widget> _children = [
    PlaceholderWidget(),
    Placeholder2Widget(),
    Placeholder3Widget(),
    Placeholder4Widget(),
  ];

  void onTabTapped(int index) {
    setState(() {
      _currentIndex = index;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: _children[_currentIndex],
      bottomNavigationBar: BottomNavigationBar(
          currentIndex: _currentIndex,
          type: BottomNavigationBarType.fixed,
          fixedColor: Colors.deepOrange,
          iconSize: 26.0,
          key: Key('BottomBar'),
          onTap: onTabTapped,
          items: [
            BottomNavigationBarItem(
                icon: Icon(Icons.home),
                title: Text('home'),
                activeIcon: Icon(Icons.home),
            ),
            BottomNavigationBarItem(
                icon: Icon(Icons.cloud_circle),
                title: Text('cloud'),
                activeIcon: Icon(Icons.cloud_circle),
            ),
            BottomNavigationBarItem(
                icon: Icon(Icons.color_lens),
                title: Text('lens'),
                activeIcon: Icon(Icons.color_lens),
            ),
            BottomNavigationBarItem(
                icon: Icon(Icons.account_box),
                title: Text('account'),
                activeIcon: Icon(Icons.account_box),
            )
          ]
      ),
    );
  }
}
